#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/3/8 20:00
# @Author  : jeff
# @FileName: user_model
import sqlalchemy

from src.model.base_model import BaseModel, db

'''
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结果uuid',
  `work_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '总任务uuid',
  `extra` json DEFAULT NULL COMMENT '全量数据',
  `create_time` datetime(3) NOT NULL,
  `update_time` datetime(3) NOT NULL,
'''


class ScanResult(BaseModel):
    __tablename__ = 'port_scan_result'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    uuid = db.Column(db.String(37), nullable=False, unique=True)
    work_uuid = db.Column(db.String(37), nullable=False)
    extra = db.Column(db.JSON)
    create_time = db.Column(sqlalchemy.DateTime, server_default=sqlalchemy.func.current_timestamp())
    update_time = db.Column(sqlalchemy.DateTime, server_default=sqlalchemy.func.current_timestamp(),
                            onupdate=sqlalchemy.func.current_timestamp())
